fixed bugs, extended functionality