single thread implementation... its actually pretty bad lol