Crappy fix for the logic which needs a refactor