Cleaned up code to comply with stylechecker