Added getters and setters
Fixed writing to file