removed static functions; fixed some major violations