clean up code
add license headers