refactored a few things