First steps towards unit tests
implements various improvement in the user_function design