Moved crop function to utils