Passed Justitia, TODO: Fix memleaks, add comments