Removed $q, cleaned up a bit