Added OS checks and checking top vs. hop via if-shell