Various functions and code to solved problems