Refactored with Stan

It's much better now...