Adding warnings, cleaning up code