Added init() function to constructor