Add detailed comments and some basic parameter parsing