minor changes
new better cost function added, also minor changes
beginning of analysis script