cleaned up stuff, added casts, removed useless things. it now compiles without warnings.