Using prepend O(1) instead of append O(n). thanks @sluu99