code cleanup, better with DOMContentLoaded