added crop function