Merged pull request, reorganized code, cleaned up a little