simplify

Refactor code to be simpler while maintaining identical functionality