rewrote Software, might be a bit crappy, also fixed clock