Added tests. Should I really attempt to do this in typescript. Consider.