working on save function and validation