got rid of all static fields and moved functions