refactored after messup