Refactored to make code conventions more consistent