refactored some things for simplicity