Changed methods so that they work correctly in terms of accessing methods and variables