Solved cursor problems + some minor changes