refactored a bit, changed a few method names