Added the remaining code, works now