refactored most things that need to be out