Code Refactor

Fixed some mistakes that got missed over the past few commits