rewrote all prototype functionality