Cleaned up some code based on PMD output