added init() function, improved formatting