Fixed some errors, now it works