Refactoring some code, fixed errors in satellite