added writing to database, changed permissions now a little messy
fixed layout issues and view update problems