Implement flood fill and hash mapping