debugging
lots of new functions added. Should be less buggy...