Adding & Fixing some Tests and Refactoring