Fixed some errors and added header