Code Cleanup & Separate Handler File