added rough well energy function, many cosmetic changes