fixed the fillElement function so it...works. Also, clean-up