work on logic
small bit of refactoring