adjusted the implementation for #43 after feedback.