Implemented most of issue #1, still needs some going over