Added flood fill and proper snapping