Fixes several bugs, adds methods