Added several utility functions

portion, .read.input, .set.msg.level
Make code format better