fixed everything with Arrays and SQL