Implemented handling for top level detection
Added another test