First draft implementation of init function