Improvements for #11, fixes: IE sorting problem, minor refactoring