calendar redraw problem fixed. major refactoring.