Slight refactor and code tuneup