Formatting code
Better performance, can_capture improved