updated copyright, minor indentation issue
portability and readability improvements, remove obsolete functions