#260 fixing code according to comments