Final Code without Registration TESTED