Optimize and refactor crop