updated with changes from addy's repo