Updated prototype for issue #58
Merge commit '6fce94fc9ee5c7b2634f82c57d932077852a7833'
Fixed bugs as a result of the merge. Now all test cases pass.