Hopefully fixed sigma determination, cleaned up the code so that amp method is shorter and hopefully easier to read