Refactoring + Bug Fixes