Update copyright
Simplify the code a bit
Remove dead code