Impelemnted more elegantly the strcuture