Simplified exp.c and added tests