prototypal: added some of the missing unit tests + some of the minor code refactorings