Removed unneccesary check and fixed first query