further simplifying the code