Code Cleanup & Null-Checks added