Added tests (10/12 passing) and finalized functions