Arrange the code and making it less dependent