adress issues #1 and #2 and refactor slightly, still needs cleanup