Fixed first round of bugs/comments from first pull request