Fixed previous commit. Added more tests cases. Added return typing to functions