fixing issues #6,#7; adding RSpec tests