Refactoring and some work on the aspnet side