made the main turn function cleaner