cleaned up code in constellation to make it more maintainable