added bugs, more complex