added buffer struct
improved structure
two parameters in init handler function
freeing hack structs