huge refactoring wasn't working properly