Index: sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java	(revision 0c049e98bcad28a13b250dd336ae01a0dffdb9ad)
+++ sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java	(revision ad4da865801ea9ff8a19bb2e47e0e53e43494de8)
@@ -53,5 +53,5 @@
         Mail mail = new Mail();
         mail.setMailTo(request.getEmail());
-        mail.setMailFrom("noreply_explore_buddy@gmail.com");
+        mail.setMailFrom("noreply_parkup@gmail.com");
         mail.setMailSubject("Account confirmation");
         mail.setMailContent(buildEmail(request.getEmail(), link));
Index: sources/app/src/main/java/parkup/repositories/ParkingSpaceRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/ParkingSpaceRepository.java	(revision 0c049e98bcad28a13b250dd336ae01a0dffdb9ad)
+++ sources/app/src/main/java/parkup/repositories/ParkingSpaceRepository.java	(revision ad4da865801ea9ff8a19bb2e47e0e53e43494de8)
@@ -10,3 +10,4 @@
     ParkingSpace findByPsId(int parkingSpaceId);
     void deleteByPsId(int parkingSpaceId);
+    void deleteAllByPsName(String name);
 }
Index: sources/app/src/main/java/parkup/services/ParkingSessionService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingSessionService.java	(revision 0c049e98bcad28a13b250dd336ae01a0dffdb9ad)
+++ sources/app/src/main/java/parkup/services/ParkingSessionService.java	(revision ad4da865801ea9ff8a19bb2e47e0e53e43494de8)
@@ -41,4 +41,12 @@
         return parkingSessionRepository.findAll().stream()
                 .filter(s->!s.getStatus().equals(SessionStatus.ENDED_PAID))
+                .collect(Collectors.toList());
+    }
+
+    public List<ParkingSession> getAllParkingSessionsFromZone(Integer pzId) {
+        //Get all sessions that arent paid
+
+        return parkingSessionRepository.findAll().stream()
+                .filter(s->!s.getStatus().equals(SessionStatus.ENDED_PAID) && s.getParkingZone().getId()==pzId)
                 .collect(Collectors.toList());
     }
@@ -92,9 +100,9 @@
             throw new IllegalStateException("No such session exists");
         }
-        else if(session.getStatus()== SessionStatus.ENDED_UNPAID){
-            throw new IllegalStateException("Cannot calculate payment on an ended session");
-        }
+//        else if(session.getStatus()!= SessionStatus.ENDED_PAID){
+//            throw new IllegalStateException("Cannot calculate payment on a paid session");
+//        }
         int price = session.getParkingZone().getPrice();
-        return (int) (Math.ceil(Duration.between(session.getTimeEnd(),session.getTimeStart()).toMinutes()/60.0)*price);
+        return (int) (Math.ceil(Duration.between(session.getTimeStart(),session.getTimeEnd()).toMinutes()/60.0)*price);
     }
     @Transactional
@@ -111,4 +119,7 @@
         if(!parkingZone.getParkingSpaces().contains(parkingSpaceRepository.findByPsName(parkingSpaceName))){
             throw new IllegalStateException("Ivalid parking space inserted. Type in a new parking space or let the admin know that they should add the parking space to this zone");
+        }
+        if(parkingSpaceRepository.findByPsName(parkingSpaceName).isTaken()){
+            throw new IllegalStateException("Ivalid parking space inserted. Type in a new parking space, this space is already in a session");
         }
         parkingSession.setStatus(SessionStatus.STARTED_VERIFIED);
Index: sources/app/src/main/java/parkup/services/ParkingZoneService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingZoneService.java	(revision 0c049e98bcad28a13b250dd336ae01a0dffdb9ad)
+++ sources/app/src/main/java/parkup/services/ParkingZoneService.java	(revision ad4da865801ea9ff8a19bb2e47e0e53e43494de8)
@@ -17,8 +17,5 @@
 import static parkup.ParkUpApplication.getToken;
 import javax.transaction.Transactional;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 
@@ -105,8 +102,8 @@
 
         //TODO prati niza od objekti ParkingSpaces i prati objekt ParkingZoneLocation
-        ParkingZone parkingZone = parkingZoneRepository.findByPzId(parkingZoneId);
+            ParkingZone parkingZone = parkingZoneRepository.findByPzId(parkingZoneId);
             ParkingZone parkingZoneNov = parkingZoneRepository.findByPzId(parkingZoneId);
             if (parkingZoneNov!=null) {
-                if (pzName != null && pzName.length() > 1) { ;
+                if (pzName != null && pzName.length() > 1) {
                     if (parkingZoneNov.getPzName().equals(pzName)&&parkingZoneNov.getId()!=parkingZoneId) {
                         throw new IllegalStateException("There is already a ParkingZone with the same name");
@@ -141,10 +138,10 @@
 
                 if (!parkingSpaces.isEmpty()) {
-                    List<String> psNamesInZone=parkingZoneNov.getParkingSpaces().stream().map(ParkingSpace::getPsName).collect(Collectors.toList());
-                    List<ParkingSpace> psToAdd=parkingSpaces.stream().filter(ps->!psNamesInZone.contains(ps.getPsName())).collect(Collectors.toList());
-                    for(ParkingSpace ps:psToAdd){
-                        parkingZoneNov.getParkingSpaces().add(ps);
-                    }
-                }else{
+                    List<ParkingSpace> spacesToDelete = parkingZoneNov.getParkingSpaces();
+                    parkingZoneNov.setParkingSpaces(null);
+                    parkingSpaceRepository.deleteAll(spacesToDelete);
+                    parkingZoneNov.setParkingSpaces(parkingSpaces);
+                }
+                else{
                     parkingZoneNov.setParkingSpaces(new ArrayList<>());
                 }
Index: sources/app/src/main/resources/application.properties
===================================================================
--- sources/app/src/main/resources/application.properties	(revision 0c049e98bcad28a13b250dd336ae01a0dffdb9ad)
+++ sources/app/src/main/resources/application.properties	(revision ad4da865801ea9ff8a19bb2e47e0e53e43494de8)
@@ -1,6 +1,6 @@
 spring.datasource.url=jdbc:postgresql://localhost:5432/parkupdb
 spring.datasource.username=postgres
-spring.datasource.password=Lampion123
-spring.jpa.hibernate.ddl-auto=create-drop
+spring.datasource.password=1234
+spring.jpa.hibernate.ddl-auto=update
 spring.jpa.show-sql=true
 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
