Fix issue with IE and cursor placement
Code cleanup