Remove unused function
Add install option
Update documentation
Code clean

 * move option parsing to own function
 * make query and aggregation mutually exclusive
Move options check to get_options function
Fix memory leaks