Cleaned up the getlastrun method