Cleaned code and created helper functions