Refactoring and cosolidating

Removed old code and merged some redundant code.