added return statements where expected