Reformulated the whole code, made arguments a fixed size array of pointers. Addressed most of the concerns.