added temporal and fixed some bugs