change to cleaner construct (thanks fredrikt)