finished modular function, haven't debugging