simplify code to look like laurens idea