Major refactor, now dynamic and working on IE