almost done minus bugs