fixed warnings and added header comments