improve margins window and resolve timer bugs