Cleaned up code using CodeMaid