Add optimized moves function. Move search functions into their own module.